Se podría creer que se forma el past perfect en frases con un verbo modal de la misma manera en la que se forma el present perfect con un verbo modal pero utilizando el simple past del verbo modal en vez del simple present. Pero no es así. Como ya lo hemos mencionado varias veces, el simple past de un verbo modal sirve para formar el condicional y por lo tanto no se puede utilizarlo para formar el past perfect. Lo que se recibe haciéndolo es un condicional II.

Formación del past perfect con verbos modales utilizando el simple past = condicional II
verbo modal + have + participio
could have gone podría haberse ido
might have done podría haber hecho
should have written debería haber escrito
needed to have read debería haber leído

Para evitar cualquier ambigüedad hay que construir con una perífrasis.

ejemplos
verbo auxiliar perífrasis perífrasis en el past perfect
can => to be able to had been able to
may => to be allowed to had been allowed to
must => to have to had had to
to be obliged to had been obliged to
to be forced to had been forced to
to be compelled to had been compelled to
shall => to be to had been to
will => to want to had wanted to
to wish had wished to

Para ver más claro.

Present perfect: I have seen him.
con un verbo modal: I can have seen him

Past perfect: I had seen him.
con un verbo modal: I could have seen him.
=>Es un condicional: Habría podido verlo.

Past perfect: I had seen him.
I had been able to see him.
=> Había podido verlo.